<template>
  <div>
    <el-form ref="form" :model="form" :rules="logFormRules" label-position="top" class="form" :show-message="false">
      <el-form-item :label="item.label" v-for="(item,index) in logFormConfin" :key="index">
        <el-form-item :prop='n.prop' v-for="(n) in item.formItem" :key="n.prop" :class="n.class?n.class:''">
          <el-input v-model="form[n.prop]" :placeholder="n.placeholder" v-if="type"></el-input>
          <div v-else class="form-text">{{ form[n.prop] }}</div>
        </el-form-item>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { logFormConfin, logFormRules } from "./confin";
export default {
  props: {
    type: {
      type: Boolean, // false: 查看详情 true:表单编辑
      default: false
    }
  },
  data() {
    return {
      logFormConfin,
      form: {
        // 事件监测
        eventMonitor: "",
        eventMonitorTitle: "",
        // 保电工作情况
        powerWork: "",
        powerWorkTitle: "",
        // 安全生产情况
        // safeProduct: "",
        // safeProductTitle: "",
        // 资源核查情况
        resourceVerification: "",
        resourceVerificationTitle: "",
        // 通信测试情况
        communicateTest: "",
        communicateTestTitle: "",
        // 日常操练情况
        dailyExercise: "",
        dailyExerciseTitle: "",
        // 日报表数据异常
        dailyReportData: "",
        dailyReportDataTitle: "",
        // 预警及处置情况
        warningDeal: "",
        warningDealTitle: "",
        // 值班重要事项
        materialNotesTitle: "",
        materialNotes: "",
        // 其他情况
        generalChronicles: "",
        generalChroniclesTitle: ""
      },
      logFormRules
    };
  },
  methods: {
    resetForm() {
      this.$refs.form.resetFields();
    }
  }
};
</script>
<style lang="less" scoped>
.form {
  :deep(.el-form-item__label) {
    font-size: 18px;
    font-weight: 700;
  }
  .form-title {
    position: absolute;
    top: -48px;
    left: 166px;
    :deep(.el-form-item__content) {
      font-weight: 700;
    }
    :deep(.el-input__inner) {
      font-weight: 700;
    }
  }
  .form-text {
    font-size: 18px;
    text-indent: 2em;
    padding-left: 10px;
  }
}
</style>
